jQuery(document).ready(function(){
	var categories = jQuery(".menu .menu-category .sub-menu");
	categories.each(function(index){
		if(index == 0){
			jQuery(this).css("display","block");
			jQuery(this).parent().children().children("img").attr("isExpand","true");
		}
		else{
			jQuery(this).css("display","none");
			jQuery(this).parent().children().children("img").attr("isExpand","false");
		}
	});
	jQuery(".menu .menu-category img").click(function(){
		if(jQuery(this).attr("isExpand") == null || jQuery(this).attr("isExpand") == "false" || 
		jQuery(this).attr("isExpand") === undefined)
		{
			jQuery(this).parent().parent().children(".sub-menu").css("display", "block");
			jQuery(this).attr("isExpand","true");
			jQuery(this).attr("src","Images/MenuExpand.png");
		}
		else
		{
			jQuery(this).parent().parent().children(".sub-menu").css("display", "none");
			jQuery(this).attr("isExpand","false");
			jQuery(this).attr("src","Images/MenuCollapse.png");
		}
		
	});
	
	//set min height
	jQuery("#container").css("min-height", jQuery(document).height() + "px");
	var rightContent = jQuery(document).height() - 92;
	jQuery(".right-content").css("min-height", rightContent + "px");
	jQuery(".menu").css("min-height", rightContent  + "px");
	GlobalScript.resizeWindow();
	jQuery(window).resize(function(){
		GlobalScript.resizeWindow();
	});
});
var GlobalScript = new Object();
GlobalScript.gridName = "";
GlobalScript.resizeWindow = function(){
	var widthGrid = jQuery(".main-wrapper").width();
	//console.log(widthGrid + " " + GlobalScript.gridName);
	if(widthGrid >= 320){
		//alert(widthGrid);
		jQuery("#" + GlobalScript.gridName).jqGrid('setGridWidth', widthGrid - 3);
	}
}